package repeat.personal.util;

import org.springframework.data.domain.Page;
import repeat.personal.page.PageResult;

import java.util.List;

/**
 * @author: Zhanggq
 * @date: 2019/5/24 11:23
 **/
public class PageResultHelp {

    /**
     * 获取分页结果
     * @param list
     * @param all
     * @return
     */
    public static PageResult getPage(List list, Page all){
        PageResult pageResult = new PageResult();
        pageResult.setContent(list);
        pageResult.setPageNum(all.getNumber());
        pageResult.setPageSize(all.getSize());
        pageResult.setTotalSize(all.getTotalElements());
        pageResult.setTotalPages(all.getTotalPages());
        return pageResult;
    }
}
